//
//  BDPostLayout.h
//  BadBoy
//
//  Created by wen on 2017/8/30.
//  Copyright © 2017年 com.8xiong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BDPostModel.h"

#define kBDCellTopMargin 8      // cell 顶部灰色留白
#define kBDCellProfileHeight 56 // cell 名片高度
#define kBDCellPadding 12       // cell 内边距
#define kBDCellOpenButtonHeight 15   // 打开按钮高度
#define kBDCellPaddingText 10   // cell 文本与其他元素间留白
#define kBDCellPaddingPic 4     // cell 多张图片中间留白
#define kBDCellCardHeight 70    // cell card 视图高度
#define kBDCellNamePaddingLeft 14 // cell 名字和 avatar 之间留白

#define kBDCellContentWidth (kBDScreenWidth - 2 * kBDCellPadding) // cell 内容宽度
#define kBDCellNameWidth (kScreenWidth - 110) // cell 名字最宽限制
#define kBDCellToolbarHeight 35     // cell 下方工具栏高度
#define kBDCellToolbarBottomMargin 2 // cell 下方灰色留白

#define kBDCellNameFontSize 14      // 名字字体大小
#define kBDCellSourceFontSize 12    // 来源字体大小
#define kBDCellTextFontSize 15      // 文本字体大小
#define kBDCellTextFontRetweetSize 14 // 转发字体大小
#define kBDCellCardTitleFontSize 14 // 卡片标题文本字体大小
#define kBDCellCardDescFontSize 12 // 卡片描述文本字体大小
#define kBDCellToolbarFontSize 14 // 工具栏字体大小

//颜色
#define kBDCellNameNormalColor [UIColor colorWithHexString:@"#333333"] // 名字颜色
#define kBDCellNameOrangeColor [UIColor colorWithHexString:@"#f26220"] // 橙名颜色 (VIP)
#define kBDCellTimeNormalColor [UIColor colorWithHexString:@"#828282"] // 时间颜色
#define kBDCellTimeOrangeColor [UIColor colorWithHexString:@"#f28824"] // 橙色时间 (最新刷出)

#define kBDCellTextNormalColor [UIColor colorWithHexString:@"#1c1c1c"] // 一般文本色
#define kBDCellTextSubTitleColor [UIColor colorWithHexString:@"#5d5d5d"] // 次要文本色
#define kBDCellTextHighlightColor [UIColor colorWithHexString:@"#527ead"] // Link 文本色
#define kBDCellTextHighlightBackgroundColor [UIColor colorWithHexString:@"#bfdffe"]// Link 点击背景色
#define kBDCellToolbarTitleColor [UIColor colorWithHexString:@"#929292"]// 工具栏文本色
#define kBDCellToolbarTitleHighlightColor [UIColor colorWithHexString:@"#df422d"]// 工具栏文本高亮色

#define kBDCellBackgroundColor [UIColor colorWithHexString:@"#f2f2f2"]// Cell背景灰色
#define kBDCellHighlightColor [UIColor colorWithHexString:@"#f0f0f0"]// Cell高亮时灰色
#define kBDCellInnerViewColor [UIColor colorWithHexString:@"#f7f7f7"]// Cell内部卡片灰色
#define kBDCellInnerViewHighlightColor  [UIColor colorWithHexString:@"#f0f0f0"]// Cell内部卡片高亮时灰色
#define kBDCellLineColor [UIColor colorWithWhite:0.000 alpha:0.09] //线条颜色

typedef NS_ENUM(NSUInteger, BDPostCardType) {
    BDPostCardTypeNone = 0,
    BDPostCardTypeCharge, //收费
    BDPostCardTypeFree,   //免费
};

@interface BDPostLayout : NSObject

- (instancetype)initWithPost:(BDPostModel *)post;
- (void)layout; ///< 计算布局
- (void)calculateHeight;///计算高度

@property (nonatomic, strong) BDPostModel *post;

// 顶部留白
@property (nonatomic, assign) CGFloat marginTop; //顶部灰色留白

// 个人资料
@property (nonatomic, assign) CGFloat profileHeight; //个人资料高度(包括留白)
@property (nonatomic, strong) YYTextLayout *nameTextLayout; // 名字
@property (nonatomic, strong) YYTextLayout *sourceTextLayout; //时间/来源

// 文本
@property (nonatomic, assign) CGFloat textHeight; //文本高度(包括下方留白)
@property (nonatomic, assign) CGFloat minTextHeight;//需要打开收起按钮的高度
@property (nonatomic, assign) BOOL isOpen;
@property (nonatomic, assign) BOOL needOpenButton;
@property (nonatomic, assign) CGFloat openButtonHeight;
@property (nonatomic, strong) YYTextLayout *textLayout; //文本

// 图片
@property (nonatomic, assign) CGFloat picHeight; //图片高度，0为没图片
@property (nonatomic, assign) CGSize picSize;

// 转发
@property (nonatomic, assign) CGFloat retweetHeight; //转发高度，0为没转发
@property (nonatomic, assign) CGFloat retweetTextHeight;
@property (nonatomic, strong) YYTextLayout *retweetTextLayout; //被转发文本
@property (nonatomic, assign) CGFloat retweetPicHeight;
@property (nonatomic, assign) CGSize retweetPicSize;
@property (nonatomic, assign) CGFloat retweetCardHeight;
@property (nonatomic, assign) BDPostCardType retweetCardType;
@property (nonatomic, strong) YYTextLayout *retweetCardTextLayout; //被转发文本
@property (nonatomic, assign) CGRect retweetCardTextRect;

// 卡片
@property (nonatomic, assign) CGFloat cardHeight; //卡片高度，0为没卡片
@property (nonatomic, assign) BDPostCardType cardType;
@property (nonatomic, strong) YYTextLayout *cardTextLayout; //卡片文本
@property (nonatomic, assign) CGRect cardTextRect;

// 工具栏
@property (nonatomic, assign) CGFloat toolbarHeight; // 工具栏
@property (nonatomic, strong) YYTextLayout *toolbarRepostTextLayout;
@property (nonatomic, strong) YYTextLayout *toolbarCommentTextLayout;
@property (nonatomic, strong) YYTextLayout *toolbarLikeTextLayout;
@property (nonatomic, strong) YYTextLayout *toolbarSharedTextLayout;
@property (nonatomic, assign) CGFloat toolbarRepostTextWidth;
@property (nonatomic, assign) CGFloat toolbarCommentTextWidth;
@property (nonatomic, assign) CGFloat toolbarLikeTextWidth;
@property (nonatomic, assign) CGFloat toolbarSharedTextWidth;

// 下边留白
@property (nonatomic, assign) CGFloat marginBottom; //下边留白

// 总高度
@property (nonatomic, assign) CGFloat height;
//详情页高度
@property (nonatomic, assign) CGFloat detailHeight;
@property (nonatomic, assign) BOOL isDetail;

@end


